<?php
class Zenddn_File_UploadFile{
    
    public function upload($filename, $uploadPath, $files = null, $options = null){
    	$upload = new Zend_File_Transfer_Adapter_Http($options);
        if($upload->isValid($files)){
            $info = $upload->getFileName($files);
            
            $ext = explode('.', $info);
            $ext = end($ext);
            
            $filename = $filename . '.' . $ext;
            $fullFileName = UPLOAD_PATH . '/' . $uploadPath . '/' . $filename;
            
            $option = array('target' => $fullFileName, 'overwrite' => true);
            
            $upload->addFilter('Rename', $option, $files);
            $upload->receive($files);
            
            return $filename;
        }else{
            return false;
        }
    }
}